!lm12
!rm75
A Sight of Sound.............Herbert A. & Herbert L. McKinstry

The Apple-Talker program that came on our disk for the S-C Assembler II Version 3.2 does some interesting things that go beyond what it was designed to do.  When we tried it out we played a recorded message from our cassette recorder into the Apple memory and were amazed at the computer rendering of the original words.

The actual quality of reproduction leaves something to be desired, so when someone said "Let's see what it sounds like," and another said "Let's hear what it looks like," we snooped around the program listing and found that what we were hearing was stored on Hi-Res graphics page one.  We looked at it by typing in $C050:0 and $C057:0.  The sight of the sound was not too loud, nor was it even obvious that what we were looking at was the sound that we had heard.

If there were a pitch there, we should see some kind of pattern.  We recorded a pitch, and saw that the sound was noisy.  So then we entered some sense into memory by creating a repeating pattern, and listened to the patterns.  We tried some like this:

!lm+5
*2000:FF FF 00 00 N 2004<2000.27FFM
*2800:FF 00 N 2802<2800.2FFFM
*3000:F0 N 3001<3000.37FFM
*3800:CC N 3801<3800.3FFEM

   and

*2000:FC 0F C0 00 N 2004<2000.27FFM
*2800:F8 3F 03 E0 N 2804<2800.2FFFM
*3000:AA N 3001<3000.37FFM
*3800:CC N 3801<3800.3FFEM
!lm-5

We liked what we saw and we saw what we heard, so our thanks to Bob Sander-Cederlof and to Victor Borge for his recognition of the sight of sound.


Your Apple Can Talk........................Bob Sander-Cederlof

Back in the summer of 1978, I spent two weeks in California with my kids.  I visited a couple of computer stores with my brother, to show him what my Apple looked like.  In one of them, I think the Byte Shop in Westminster on Beach Blvd., the proprietor mentioned in passing an astonishing event.  He told me, "A high schooler was in here a few weeks ago with a program that produced speech out of the Apple speaker!"  "Impossible," I mumbled.

A few weeks later I heard rumors of a program by Bob Bishop which did indeed make the Apple talk.  I think it was in the September meeting of the Dallas Apple Corps that I overheard his program running.  From amazement to insight took only a few seconds...I almost RAN home to write a program to do the same thing!

A month or two later I handed out copies of the program and gave a talk on the subject of speech synthesis and recognition.  When Version 3.2 of the S-C Assembler was released, I included the same program as an example.  Then again on version 4.0

Meanwhile, Bob Bishop released several neat tapes through Softape, including a talking calculator, "Apple Talker", and "Apple Listener".  The latter program did some limited speech recognition through the cassette port, with no additional hardware.  I bought the last two, and I still have the tape somewhere, but I have never loaded it.

About two years later Muse Software started marketing a program on disk to evoke speech from the Apple.  I believe they included some sort of "editor" to allow you to make your own programs talk.  I never saw or heard it, so I don't know.

As far as I know, the basic idea behind all of these programs is the same:  approximate the waveform of spoken words by toggling the Apple speaker.  You can hook a microphone up to the cassette input port and toggle the output speaker whenever the input port changes.  Or you can record a message on tape, and "play" in into the Apple.

My program samples the cassette input port about 6000 times per second.  If the input byte is $80 or larger, I store a "1"; if less than $80, I store a "0".  I pack eight bits in a byte, and store the bytes in a buffer from $4000 through $5FFF.  The buffer is 8192 bytes long, so that is 65536 samples or about 10 seconds of stored sound.  You could store more samples or less samples, according to your own needs.

The playback loop looks at the stored bits at the same rate, and toggles the speaker whenever there is a change from 1 to 0 or 0 to 1.  The result is actually understandable, though somewhat scratchy.

As the McKinstry's pointed out, my choice of buffer coincides with the Hi-Res Graphics page.  In the copy of the program they have, I used $2000-3FFF, which is Hi-Res page one.  Now I use $4000-5FFF, Hi-Res page two, so it will not erase the last half of the S-C Assembler when I test the program.  Taking their suggestions to heart, I added the code to turn on the Hi-Res display during recording and playback, and to turn it off when finished.

When looking at the display you need to bear in mind the complex way the bytes are arranged on the Hi-Res screen.  For starters, the bits are backwards in each byte.  And remember that only seven bits of each byte show up on the screen -- the 8th bit shifts the other seven one half dot position.  And the big confuser is the way the lines are arranged.  (See Mike Laumer's article in the July ,1982 issue of AAL, page 15ff, for a discussion of the line arrangement.)

I prepared some EXEC files which initialize the buffer to various patterns, including the ones the two Herberts suggested.  (It is amazing how handy it is to be able to create/modify little text files like these using the editor in the S-C Macro Assembler!)

!lm+5
Sound #1

$4000:FF FF 00 00 N 4004<4000.47FFM
$4800:FF 00 N 4802<4800.4FFFM
$5000:F0 N 5001<5000.57FFM
$5800:CC N 5801<5800.5FFEM


Sound #2

$5800:CC N 5801<5800.5FFEM
$5000:AA N 5001<5000.57FEM
$4800:F8 3F 03 E0 N 4804<4800.4FFCM
$4000:FC 0F C0 00 N 4004<4000.47FCM


Sound #3

$4000:00 01 03 07 0F 1F 3F 7F FF FE FC F8 F0 E0 C0 80
$4010<4000.5FEFM


Sound #4

$4000:00 FF 00 00 FF FF 00 00 00 00 FF FF FF FF
$400E<4000.5FFFM


Sound #5

$4000:00 88 00 00 88 88 00 00 00 00 88 88 88 88
$400E<4000.5FFFM
!lm-5

To play back one of the sound above, simple EXEC or type in the monitor commands, and then "MGO TALK".

Looking at the program which follows, you find three main routines.  ECHO (lines 1180-1300) samples the cassette port about 6000 times per second; if it has changed, the speaker is toggled.  After each toggle the keyboard strobe is examined, so that typing any key can stop the program and return to the caller.

RECORD (lines 1560-1710) stores 65536 samples in the buffer.  TALK (lines 1750-1950) play back the buffer contents.  You can play with the sample rate and playback rate by modifying the constant 30 in lines 1590 and 1790.  It is amusing to play back a message faster or slower than it was recorded.

Both RECORD and TALK use a monitor subroutine called NXTA to control the loop.  This is the same subroutine used by the monitor memory display and memory move commands.  NXTA tests the current value of A1L,A1H ($3C,$3D) against A2L,A2H ($3E,$3F), and sets carry if A1 is greater than or equal to A2.  Then it increments A1.

I tried various schemes for packing the bits in the buffer, to save space for more speech.  None of them were effective enough to bother with, but you might run on to one that is.  I also experimented with isolating words and individual phonemes, and with trying to filter out the scratchiness.  I was not satisfied with any of my results.  If you are successful, I would like to hear about it.

[ A later note:  I just received Dec-82 Creative Computing, and there are reviews of several speech synthesis systems.  One, called "Software Automatic Mouth (SAM)", is  claimed to be a "high quality speech synthesizer created entirely in software."  SAM costs $125 ($99 from Huntington Computing from now until the end of the year).  In spite of the claim, it is not entirely software.  There is also a small board containing a digital-to-analog converter (DAC), an audio amplifier, and a volume control.  You can hook it up to the speaker in the Apple, or supply an external speaker.  The ad claims it enables you to add speech to your programs with ease, but bear in mind that the software takes 9K of RAM, and 6K more if you want to automatically translate straight English text to speech. ]
